<!--
 *代码由框架生成,任何更改都可能导致被代码生成器覆盖
 *业务请在@/extension/business/productdata/ProductData.js此处编写
 -->
<template>
    <view-grid ref="grid"
               :columns="columns"
               :detail="detail"
               :editFormFields="editFormFields"
               :editFormOptions="editFormOptions"
               :searchFormFields="searchFormFields"
               :searchFormOptions="searchFormOptions"
               :table="table"
               :extend="extend">
    </view-grid>
</template>
<script>
    import extend from "@/extension/business/productdata/ProductData.js";
    import { ref, defineComponent } from "vue";
    export default defineComponent({
        setup() {
            const table = ref({
                key: 'Id',
                footer: "Foots",
                cnName: '产品主数据',
                name: 'productdata/ProductData',
                url: "/ProductData/",
                sortName: "CreateDate",
                foreignKey:"ProductId"
            });
            const editFormFields = ref({"Name":"","MaterialNo":"","Enable":""});
            const editFormOptions = ref([[{"title":"产品名称","field":"Name"},
                               {"title":"产品编号","field":"MaterialNo"},
                               {"dataKey":"enable","data":[],"title":"是否启用","field":"Enable","type":"select"}]]);
            const searchFormFields = ref({"Name":"","MaterialNo":"","Enable":""});
            const searchFormOptions = ref([[{"title":"产品名称","field":"Name"},{"title":"产品编号","field":"MaterialNo"},{"dataKey":"enable","data":[],"title":"是否启用","field":"Enable","type":"select"}]]);
            const columns = ref([{field:'Id',title:'主键',type:'string',width:110,hidden:true,readonly:true,require:true,align:'left'},
                       {field:'Name',title:'产品名称',type:'string',width:110,align:'left',sort:true},
                       {field:'MaterialNo',title:'产品编号',type:'string',link:true,width:110,align:'left'},
                       {field:'Enable',title:'是否启用',type:'int',bind:{ key:'enable',data:[]},width:110,align:'left'},
                       {field:'CreateUserName',title:'添加人',type:'string',width:110,align:'left'},
                       {field:'CreateUserId',title:'添加人ID',type:'string',width:110,hidden:true,align:'left'},
                       {field:'CreateDate',title:'添加时间',type:'datetime',width:150,align:'left',sort:true},
                       {field:'ModifyUserName',title:'修改人',type:'string',width:110,align:'left'},
                       {field:'ModifyUserId',title:'修改人ID',type:'string',width:110,hidden:true,align:'left'},
                       {field:'ModifyDate',title:'修改时间',type:'datetime',width:150,align:'left',sort:true},
                       {field:'DeletionFlag',title:'删除标识',type:'int',width:110,hidden:true,align:'left'}]);
            const detail = ref({
                cnName: "产品主数据_物料数据",
                table: "ProductMaterials",
                columns: [{field:'Id',title:'主键',type:'string',width:110,hidden:true,readonly:true,require:true,align:'left'},
                       {field:'ProductId',title:'产品ID',type:'string',width:110,hidden:true,align:'left'},
                       {field:'MaterialsId',title:'物料ID',type:'string',width:110,hidden:true,readonly:true,edit:{type:''},align:'left'},
                       {field:'MaterialsName',title:'物料名称',type:'string',width:150,readonly:true,edit:{type:''},align:'left',sort:true},
                       {field:'YieldRate',title:'所得率',type:'decimal',width:140,edit:{type:''},align:'left'},
                       {field:'CreateUserName',title:'添加人',type:'string',width:110,align:'left'},
                       {field:'CreateUserId',title:'添加人ID',type:'string',width:110,hidden:true,align:'left'},
                       {field:'CreateDate',title:'添加时间',type:'datetime',width:150,align:'left',sort:true},
                       {field:'ModifyUserName',title:'修改人',type:'string',width:110,align:'left'},
                       {field:'ModifyUserId',title:'修改人ID',type:'string',width:110,hidden:true,align:'left'},
                       {field:'ModifyDate',title:'修改时间',type:'datetime',width:150,align:'left',sort:true},
                       {field:'DeletionFlag',title:'删除标识',type:'int',width:110,hidden:true,align:'left'}],
                sortName: "MaterialsId",
                key: "Id"
            });
            return {
                table,
                extend,
                editFormFields,
                editFormOptions,
                searchFormFields,
                searchFormOptions,
                columns,
                detail,
            };
        },
    });
</script>
